package com.oromwin.repos.server.request.media;

import java.io.DataOutputStream;
import java.io.IOException;

import org.apache.commons.logging.Log;

import com.oromwin.repos.server.request.Request;
import com.oromwin.repos.common.Logger;
import com.oromwin.repos.common.ReposException;
import com.oromwin.repos.common.helper.IOHelper;

public class UpdateMediaRequest implements Request {
    private Log log = Logger.getLog(UpdateMediaRequest.class);
    private String MediaId = null;
    private long MediaMaxBytes = 0L;
    
    public UpdateMediaRequest(String mediaId, long mediaMaxBytes) {
        MediaId = mediaId;
        MediaMaxBytes = mediaMaxBytes;
    }
    
    public void send(DataOutputStream dos) throws ReposException {
        try {
            IOHelper.writeUTF8(dos, this.getClass().getName());
            IOHelper.writeUTF8(dos, MediaId.toString());
            dos.writeLong(MediaMaxBytes);
            dos.flush();
        } catch (IOException e) {
            throw ReposException.create(log, e);
        }
    }

}
